$.fn.editInLine = function (callback) {
   $(this).css({
      padding: "0px 0px 0px 0px",
      cursor: "pointer"
   }).hover(function () {
      $(this).css({
         backgroundColor: "#f8f8e8"         
      });
   }, function () {
      $(this).css({
                
      });
   }).click(function () {
      var td = $(this);
      td.css({
         padding: "0px 0px 0px 0px"         
      });

      if (td.find("input").length == 0) {
         var text = td.text();
         td.html("<input type=\"text\" style=\"width: 97%; text-align:center; \" />");       

         td.find("input").focus().val("").focus().val(text).blur(function () {
            var val = $(this).val();
            if (text != val) {
               if (callback != undefined) {
                  callback();
               } 
               
               td.css({
                  color: "black",                  
                  padding: "0px 5px 0px 0px",
                  "text-align": "center"
               });
            }

            td.html(val);
         });
      }
   });
}